/**
  ******************************************************************************
  * @file    main.h 
  * @author  MCD Application Team
  * @version V3.4.0
  * @date    10/15/2010
  * @brief   Header for main.c module
  ******************************************************************************
  */ 

/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __MAIN_H
#define __MAIN_H

/* Includes ------------------------------------------------------------------*/
#include "stm32f10x.h"

/* Exported types ------------------------------------------------------------*/

#define BOOT_CODE_VER	(BKP_DR2 | 0x0100)
#define APP_MODE		(BKP_DR3 | 0x0100)	//low byte
#define EXCEPTION		(BKP_DR5 | 0x0100)
#define WATCH_DOG		(BKP_DR5 | 0x0000)
#define OTA_FLAG		(BKP_DR8 | 0x0100)
#define OTA_CHECKSUM	(BKP_DR9 | 0x0100)
#define RTC_UPDATE		(BKP_DR4 | 0x0100)
#define SOS_EVENT		(BKP_DR6 | 0x0100)

typedef enum {
	POWER_OFF_MODE		= 0,
	TRACK_MODE			= 1,
	OTA_MODE			= 2,
	LOW_BATTERY_MODE	= 3,
}APPMODE;

extern APPMODE AppMode;


/* Exported constants --------------------------------------------------------*/
/* Exported macro ------------------------------------------------------------*/
/* Exported functions ------------------------------------------------------- */
void SPI_FLASH_SubSectorErase(u32 SectorAddr);

void Param_Check_Task(void);
void Test_Task(void);

void Write_Backup_Reg(unsigned short id, unsigned char value);
void UpdateRTC_Hook(void);

#endif /* __MAIN_H */

/******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/
